package com.winphone.weekly.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.winphone.weekly.entity.Menu;

@Controller
@RequestMapping("/")
public class IndexController {

	@RequestMapping(value = "/index",method = RequestMethod.GET)
	public String index(Model model){
		
//		INSERT INTO `sys_menu` VALUES ('40288ab85a5eecc6015a5ef22ad80001', '系统设置', null, '', null, null, '', '1', '2', 'fa-gear', '', null, null, null, null, '0');
//		INSERT INTO `sys_menu` VALUES ('40288ab85a5eecc6015a5ef6ce870002', '用户管理', null, 'sys/user', '40288ab85a5eecc6015a5ef22ad80001', '40288ab85a5eecc6015a5ef22ad80001/', 'sys:user:list', '1', '1', 'fa-tv', 'sdfdsfsdfsdfsdfsdfsf', null, null, null, null, '0');
		List<Menu> list = new ArrayList();
		Menu menu = new Menu();
		menu.setId("40288ab85a5eecc6015a5ef22ad80001");
		menu.setName("系统设置");
		menu.setType(null);
		menu.setUrl("");
		menu.setParentId(null);
		menu.setParentIds(null);
		menu.setPermission("");
		menu.setIsshow((short)1);
		menu.setSort(2);
		menu.setMenuIcon("fa-gear");
		
		list.add(menu);
		
		Menu menu1 = new Menu();
		menu1.setId("40288ab85a5eecc6015a5ef6ce870002");
		menu1.setName("用户管理");
		menu1.setType(null);
		menu1.setUrl("sys/user");
		menu1.setParentId("40288ab85a5eecc6015a5ef22ad80001");
		menu1.setParentIds("40288ab85a5eecc6015a5ef22ad80001/");
		menu1.setPermission("");
		menu1.setIsshow((short)1);
		menu1.setSort(1);
		menu1.setMenuIcon("fa-tv");
		
		Menu m = null;
		for (int i = 0; i < 10; i++) {
			m = new Menu();
			m.setId(String.valueOf(i));
			m.setName("用户管理"+i);
			m.setType(null);
			m.setUrl("sys/user"+i);
			m.setParentId("40288ab85a5eecc6015a5ef22ad80001");
			m.setParentIds("40288ab85a5eecc6015a5ef22ad80001/");
			m.setPermission("");
			m.setIsshow((short)1);
			m.setSort(1);
			m.setMenuIcon("fa-tv");
			list.add(m);
			m = null;
		}
		
		list.add(menu1);
		
		// 加载菜单
		model.addAttribute("menus", list);
		return "index-ace";
	}

	
	@RequestMapping(value = "/dashboard",method = RequestMethod.GET)
	public String dashboard(){
		return "dashboard";
	}
}
